# 爬取萍乡学院官网的页面信息，将爬取到的页面保存到“D:\\萍乡学院.html”(注意字符编码问题和UA伪装)。
import requests

url = "http://www.pxu.edu.cn/"
headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.99 Safari/537.36"}
response = requests.get(url, headers = headers)
response.encoding = 'utf-8'
txt = response.text
fi = open("D:\\萍乡学院.html", 'w', encoding='utf-8')
fi.write(txt)
fi.close()
print(response.status_code)
print(response.text)